package chapter5.No5_1_定时器Timer的使用.demo3;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

/**
 * 计划时间早于当前时间 -- 立刻运行
 * Created by Administrator on 2016/11/24.
 */
public class Main {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        c.set(Calendar.SECOND, c.get(Calendar.SECOND) - 10);
        Date d = c.getTime();

        MyTask task = new MyTask();
        Timer timer = new Timer();
        System.out.println("开始的时间："+System.currentTimeMillis());
        timer.schedule(task, d);
    }
}
